home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util1 / ultmtpch.lha / UPS / Sources / AllocMem.s next >
Text File  |  1995-09-25  |  3KB  |  149 lines

  1. ;TOSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  2.  
  3.     incdir    "include:"
  4.     include    "exec/exec.i"
  5.     include    "libs/exec.i"
  6.     incdir    "ups:"
  7.     include    "ups.i"
  8.  
  9.  
  10.  
  11. Start    moveq    #0,d0
  12.     rts
  13. .end    ds.b    32+Start-.end
  14.     dc.l    pfsControlLong
  15.     dc.l    0            ; pointer to next patcher
  16.     dc.l    0            ; pointer to prev patcher
  17.     dc.l    UPSMainVersion        ; minimum version of UPS to start
  18.     dc.l    UPSMainVersion        ; version of UPS which was used
  19.                     ; while patcher was developed
  20.     dc.l    PatcherName        ; pointer to name of patcher
  21.     dc.w    39,0            ; version
  22.     dc.l    CoderName        ; pointer to name of programmer
  23.     dc.l    VerString        ; pointer to $VER: string
  24.     dc.l    PatcherIDString        ; listview entry
  25.     dc.l    pfsDisableable        ; flags
  26.     dc.l    0            ; status of flags
  27. execbase
  28.     dc.l    0            ; exec base
  29. intbase    dc.l    0            ; intuition base
  30. gadtbase
  31.     dc.l    0            ; gadtools base
  32. dosbase    dc.l    0            ; dos base
  33. gfxbase    dc.l    0            ; graphics base
  34. cxbase    dc.l    0            ; commodities base
  35. laybase    dc.l    0            ; layers base
  36. upsbase    dc.l    0            ; UPS lib base
  37.     dc.l    0            ; pointer to init routine
  38.     dc.l    0            ; pointer to exit routine
  39.     dc.l    0            ; pointer to prefs routine
  40.     dc.l    0            ; pointer to cx keys to call prefs rout
  41.     dc.l    Resources        ; pointer to structure of requested
  42.                         ; opened resources
  43.     dc.l    Patch1            ; pointer to structure for patches
  44.     dc.l    pls1            ; pointer to pls structure
  45.     dc.l    0            ; pointer to main UPS msg port
  46.     dc.l    0            ; pointer to rexx port
  47.     dc.l    0            ; pointer to pxs structure
  48.     dc.l    0,0,0
  49.     dc.l    pfsControlLong
  50.     dc.l    Start            ; pointer to the beginning of struct
  51.  
  52. PatcherName
  53.     dc.b    'AllocMem() patcher',0
  54.     even
  55. CoderName
  56.     dc.b    'Goran Mitrovic',0
  57.     even
  58. VerString
  59.     dc.b    '$VER: AllocMem patcher V1.0',0
  60.     even
  61. PatcherIDString
  62.     dc.b    'Memory Defrag',0            ; 25
  63.     even
  64.  
  65.  
  66.  
  67. Resources
  68.     dc.l    0            ; pointer to next entry
  69.     dc.l    0            ; pointer to previous entry
  70.     dc.l    rt_Library        ; type of resource
  71.     dc.l    100            ; resource id
  72.     dc.l    0            ; flags
  73.     dc.l    res1name        ; pointer to name of resource
  74. res1base
  75.     dc.l    0            ; base of opened resource
  76.     dc.l    36            ; version, if needed
  77.     ds.l    8            ; ...to put in data regs
  78.     dc.l    0            ; user open rout for user type
  79.     dc.l    0            ; user close rout for user type
  80.     dc.l    0            ; pointer to name for user type
  81.     dc.l    0,0
  82.  
  83. res1name
  84.     dc.b    'exec.library',0
  85.     cnop    0,4
  86.  
  87.  
  88.  
  89. Patch1
  90.     dc.l    0            ; pointer to next patch
  91.     dc.l    0            ; pointer to prev patch
  92.     dc.l    100            ; priority, less runs first
  93.     dc.l    Start            ; pointer to parent Patcher
  94.     dc.l    Patch1ID        ; listview entry
  95.     dc.l    Patch1purpose        ; pointer to purpose string
  96.     dc.l    100            ; id of resource to be patched
  97.     dc.l    mpsDisableable        ; flags
  98.     dc.l    0            ; status of flags
  99.     dc.l    AllocMem        ; offset to change
  100.     dc.l    alloc            ; pointer to new routine
  101.     dc.l    0            ; pointer to old routine
  102.     dc.l    0            ; pointer to pns structure
  103.     dc.l    0            ; notified when enabled/disabled
  104.     dc.l    0            ; install rout for user type
  105.     dc.l    0            ; uninstall rout for user type
  106.     dc.l    0            ; pointer to init routine
  107.     dc.l    0            ; pointer to exit routine
  108.     dc.l    pls1            ; pointer to pls structure
  109.     dc.l    0,0,0,0
  110.  
  111.  
  112. Patch1ID
  113.     dc.b    'AllocMem()',0            ; 27
  114.     even
  115. Patch1purpose
  116.     dc.b    'improving',0            ; 16
  117.     cnop    0,4
  118.  
  119.  
  120.  
  121. pls1    dc.l    0            ; pointer to next link
  122.     dc.l    0            ; pointer to prev link
  123.     dc.l    pls1ID            ; listview string
  124.     dc.l    0            ; pointer to prefs routine
  125.     dc.l    plsDisableable        ; flags
  126.     dc.l    0            ; status
  127.     dc.l    Patch1
  128.     dc.l    0
  129.  
  130. pls1ID    dc.b    'AllocMem()',0            ; 27
  131.     cnop    0,4
  132.  
  133.  
  134.  
  135.  
  136. alloc    and.l    #$ffffffff-MEMF_REVERSE,d1
  137.     cmp.l    #1024,d0
  138.     bgt.s    .exit
  139.     tst.l    flip
  140.     bne.s    .yes
  141.     move.l    #-1,flip
  142.     bra.s    .exit
  143. .yes    move.l    #0,flip
  144.     or.l    #MEMF_REVERSE,d1
  145. .exit    rts
  146.  
  147.  
  148. flip    dc.l    0
  149.